﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    //4、超人、小鸟、飞机
    class Flight//飞行
    {
        private string name;
        public string Name { get => name; set => name = value; }
        public Flight(string name)
        {
            this.name = name;
        }
        public Flight()
        {

        }
    }
    interface IFly
    {
        void Fly();
    }
    interface ILand
    {
        void Land();
    }
    interface IEat
    {
        void Eat();
    }
    class Superman:Flight,IFly,ILand,IEat
    {
        public void Fly()
        {
            Console.WriteLine("姓名叫{0}的超人正在飞行",this.Name);
        }
        public void Land()
        {
            Console.WriteLine("姓名叫{0}的超人正在着陆", this.Name);
        }
        public void Eat()
        {
            Console.WriteLine("姓名叫{0}的超人正在吃饭", this.Name);
        }
        public Superman(string name):base(name){

        }
    }
    class Bird : Flight, IFly, ILand, IEat
    {
        public void Fly()
        {
            Console.WriteLine("名叫{0}的小鸟正在飞行", this.Name);
        }
        public void Land()
        {
            Console.WriteLine("名叫{0}的小鸟正在着陆", this.Name);
        }
        public void Eat()
        {
            Console.WriteLine("名叫{0}的小鸟正在吃虫", this.Name);
        }
        public Bird(string name) : base(name)
        {

        }
    }
    class Plane : Flight, IFly, ILand, IEat
    {
        public void Fly()
        {
            Console.WriteLine("名叫{0}的战斗机正在飞行", this.Name);
        }
        public void Land()
        {
            Console.WriteLine("名叫{0}的战斗机正在着陆", this.Name);
        }
        public void Eat()
        {
            Console.WriteLine("名叫{0}的战斗机正在加油----", this.Name);
        }
        public Plane(string name) : base(name)
        {

        }
    }
    class Program3
    {
        static void TestFly(IFly fly)
        {
            fly.Fly();
        }
        static void TestLand(ILand land)
        {
            land.Land();
        }
        static void TestEat(IEat eat)
        {
            eat.Eat();
        }
        static void Main(string[] args)
        {
            Superman superman = new Superman("派大星");
            Bird bird = new Bird("九日");
            Plane plane = new Plane("王牌");
            TestFly(superman);
            TestLand(superman);
            TestEat(superman);
            Console.WriteLine();
            TestFly(bird);
            TestLand(bird);
            TestEat(bird);
            Console.WriteLine();
            TestFly(plane);
            TestLand(plane);
            TestEat(plane);
            Console.WriteLine();
            Console.ReadKey();
        }
    }
}
